#pragma once

#include "FastSerial.h"
#include "GPS.h"
#include <Arduino.h>
#include <StandardCplusplus.h>
#include <vector>

class MyGPS : public GPS
{
public:
	MyGPS(Stream *s);
	
	typedef struct {
		uint8_t prn,elev,azi,snr;
	}Sat;
	
	void init();
	bool read();
	
	double my_lat,my_lon,my_alt,my_speed,my_hdop,my_vdop,my_pdop,my_course,my_deviation;
	
	std::vector<Sat> my_vsat,my_vsat_temp;
	std::vector<uint8_t> my_active_sat;
	//alt in feet
	//speed in knots
	
private:
	char buffer[200];
	int sz,pos;
	
	bool _decode(char c);
	void parse_GGA();
	void parse_RMC();
	void parse_GSA();
	void parse_GSV();
	void parse_GLL();
	void parse_VTG();
	void skip();
	double getLatLon();
	long getTime();
	double getDouble();
	int getInt();
	bool isType(const char *type);
	bool passChecksum();
	int hexToInt(char c);
	int getN();
};